<template>
	<view class="container">
		<view class="t-box dis-flex">
			<view class="title" style="width: 30%;">错题列表</view>
			<view style="color: red;">{{book_name}}：{{fanwei}}</view>
		</view>

		<view class="table">
			<view class="top">
				<view class="tips b-r">题目</view>
				<view class="tips b-r">答题内容</view>
				<view class="tips">正确答案</view>

			</view>
			<view class="lists">

				<view class="item" v-for="(item,index) in cuowuList">
					<view class="tt" style="display: flex;justify-content: center;align-items: center;">
						<view>
							<view>{{item.name}}</view>

						</view>
					</view>
					<view class="tt" v-if="item.status==2" style="color: red;">
						<view>{{item.content}}</view>
						<view>{{item.content2}}</view>
					</view>
					<view class="tt" v-else>
						<view>{{item.content}}</view>
						<view>{{item.content2}}</view>
					</view>
					<view class="tt" style="display: flex;justify-content: center;align-items: center;">
						<view class="btn" @click="look(item)" v-if="item.status==2">点击查看</view>

					</view>

				</view>

			</view>

		</view>

		<u-popup v-model="show" mode="center" width="80%" border-radius="14">
			<view class="info">

				<view class="p-name">{{detail.name}}</view>
				<view class="p-shi">
					释义
				</view>
				<view class="jieshi">
					<view>{{detail.answer}}</view>
				</view>

				<block v-if="paper.name_en">
					<view style="padding-bottom: 80rpx;padding-top: 20rpx;">
						<view class="p-tihuan">
							替换词
						</view>
						<view class="p-name">{{paper.name_en}}</view>
					</view>

				</block>

				<view class="pop-btn">

					<view class="p-btn" @click="show=false">确定</view>

				</view>
			</view>
		</u-popup>

	</view>
</template>

<script>
	import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
	import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
	import * as PaperApi from '@/api/ant/paper'
	import {
		getEmptyPaginateObj,
		getMoreListData
	} from '@/core/app'



	export default {
		components: {
			MescrollBody
		},
		mixins: [MescrollMixin],
		data() {
			return {
				paperId: 0,
				duration: 10,
				cuowuList: [],
				detail: {},
				paper: {},
				book_name:'',
				fanwei:'',


				show: false
			}
		},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad(options) {

			this.paperId = options.paperId
			this.getPaperDetail()
		},

		methods: {

			getPaperDetail() {
				const app = this
				app.isLoading = true

				PaperApi.detail(app.paperId)
					.then(result => {


						var lists = result.data.detail.timu

						var cuowuList = []
						this.paper = result.data.detail
						
						this.fanwei= result.data.detail.fanwei
						this.book_name=result.data.detail.book_name
						// lists.forEach(item => {
						// 	if (item.status == 2) {
						// 		cuowuList.push(item)

						// 	}
						// })

						this.cuowuList = lists



					})
					.finally(() => app.isLoading = false)
			},

			look(item) {
				PaperApi.detail_answer(item.paper_id, item.id)
					.then(result => {

						this.show = true
						this.detail = result.data.detail
						this.paper = result.data.paper



					})


			},

			next() {
				this.percent = 100
				this.num += 1
				this.duration = 10

				this.$refs.uCountDown.update();


			},

			start() {
				this.$refs.uCountDown.start();
			},
			// 事件触发，每秒一次
			change(timestamp) {
				console.log(timestamp);
				console.log(this.percent);
				this.percent = 10 * timestamp
			},



		}
	}
</script>

<style lang="scss" scoped>
	.table {
		padding-bottom: 120rpx;
	}

	.info {
		min-height: 600rpx;
		text-align: center;
		padding: 20rpx 30rpx;
		background-color: #F5F5F5;

		.p-name {
			height: 80rpx;
			color: rgba(22, 132, 252, 1);
			font-size: 56rpx;
		}

		.p-tihuan {

			height: 76rpx;
			line-height: 76rpx;
			color: rgba(0, 0, 0, 1);
			font-size: 40rpx;
		}

		.p-shi {
			height: 106rpx;
			color: rgba(0, 0, 0, 1);
			font-size: 40rpx;
		}

		.jieshi {
			background-color: #FFF;
			height: 250rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			border-radius: 10rpx;
		}

		.pop-btn {
			display: flex;
			justify-content: center;
		}

		.p-btn {
			margin-top: 40rpx;
			width: 80%;
			height: 84rpx;
			line-height: 84rpx;
			border-radius: 60rpx;
			background: linear-gradient(180deg, rgba(22, 132, 252, 1) 0%, rgba(100, 174, 255, 1) 100%);
			color: rgba(255, 255, 255, 1);
			font-size: 32rpx;
		}
	}


	.container {
		height: 932px;
		width: 100%;

	}

	.item {
		display: flex;
		text-align: center;
		border-bottom: solid 1rpx #E8E8E8;
		font-size: 28rpx;
		padding: 20rpx 0;

		.tt {
			width: 33.33%;

			line-height: 54rpx;
		}

		.btn {
			width: 140rpx;
			height: 52rpx;
			line-height: 52rpx;
			border-radius: 8rpx;
			background-color: rgba(22, 132, 252, 1);
			color: rgba(255, 255, 255, 0.88);
			font-size: 24rpx;
		}
	}

	.t-box {
		padding: 30rpx 60rpx;
	}

	.title {
		height: 32rpx;
		border-left: solid 6rpx #64AEFF;
		font-size: 28rpx;
		color: rgba(16, 16, 16, 1);
		font-weight: bold;
		padding-left: 10rpx;
	}

	.top {
		width: 100%;
		height: 60rpx;
		line-height: 40rpx;
		background-color: #E8E8E8;
		padding: 10rpx 0;
		font-size: 28rpx;
		display: flex;
		justify-content: space-between;

	}

	.b-r {
		border-right: solid 1rpx #FFF
	}

	.tips {
		text-align: center;
		width: 33.33%;
	}
</style>